﻿using SqlSugar;

namespace ChatBackend.Entity
{
    /// <summary>
    /// 实体基类，审计属性
    /// </summary>
    public abstract class BaseEntity
    {
        /// <summary>
        /// 主键
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, ColumnDataType = "bigint")]
        public string Id { get; set; } = SnowFlakeSingle.Instance.NextId().ToString();

        /// <summary>
        /// 创建者
        /// </summary>
        [SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = true)]//修改时忽略
        public string CreateBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = true)]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 修改者
        /// </summary>
        [SugarColumn(IsOnlyIgnoreInsert = true, IsNullable = true)]//新增时忽略
        public string? ModifyBy { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        [SugarColumn(IsOnlyIgnoreInsert = true, IsNullable = true)]
        public DateTime? ModifyTime { get; set; }

        /// <summary>
        /// 逻辑删除
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public bool IsDelete { get; set; }
    }
}